<template>
  <div class="page-header">
    <div class="header-content">
      <div class="header-title">
        <h2>{{ title }}</h2>
        <div class="subtitle" v-if="$slots.subtitle">
          <slot name="subtitle"></slot>
        </div>
      </div>
      <div class="header-actions" v-if="$slots.actions">
        <slot name="actions"></slot>
      </div>
    </div>
    <div class="header-divider"></div>
  </div>
</template>

<script>
export default {
  name: 'Header',
  props: {
    /**
     * 页面标题
     */
    title: {
      type: String,
      required: true
    }
  }
}
</script>

<style scoped>
.page-header {
  margin-bottom: 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.header-title {
  display: flex;
  align-items: center;
}

.header-title h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #303133;
}

.subtitle {
  margin-left: 15px;
  display: flex;
  align-items: center;
}

.header-divider {
  height: 1px;
  background-color: #EBEEF5;
  margin-top: 10px;
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-actions {
    margin-top: 10px;
    width: 100%;
  }
  
  .subtitle {
    margin-left: 0;
    margin-top: 5px;
  }
}
</style>